﻿using System.Collections.Generic;
using Model;

namespace MDFGame
{
    /// <summary>
    /// 全局卡片数据静态字段
    /// </summary>
    public abstract class CardInfo
    {
        public string Series { get; }//卡片系列名称[缩写]
        public int Snum { get; }//卡片系列内编号
        public string Rare { get; }//卡片罕贵度标识
        public string CardName { get; }//卡片名称
        public bool IsFinalCard { get; }//当前卡是否为终符
        public CardType CType { get; }//当前卡片类型[角色/战斗/特殊]
        public string Illust { get; }//当前卡片画师信息
        /// <summary>
        /// 测试用卡初始化
        /// </summary>
        public CardInfo()
        {
            Series = "Undef"; Snum = 0; Rare = "R"; Illust = "null";
            CardName = "Unknown"; IsFinalCard = false; CType = CardType.Undefined;
        }
        /// <summary>
        /// 卡数据初始化
        /// </summary>
        /// <param name="series">卡片系列</param>
        /// <param name="snum">卡片系列内编号</param>
        /// <param name="rare">卡片罕贵度标识</param>
        /// <param name="name">卡片名称</param>
        /// <param name="ifc">当前卡是否为终符</param>
        /// <param name="type">当前卡片类型[角色/战斗/特殊]</param>
        /// <param name="ill">当前卡片画师信息</param>
        public CardInfo(string series, int snum, string rare, string name, bool ifc, CardType type, string ill)
        {
            Series = series; Snum = snum; Rare = rare; CardName = name; IsFinalCard = ifc; CType = type; Illust = ill;
        }
        /// <summary>
        /// 获取对应卡的卡图的卡名
        /// </summary>
        /// <returns></returns>
        public string[] GetPic()
        {
            string[] temp = new string[2];
            if (CType == CardType.Character)
            {
                temp[0] = Series + "-C-" + Snum;
                temp[1] = Series + "-C-" + Snum + "s";
            }
            else
            {
                temp[0] = Series + Snum;
                temp[1] = Series + Snum + "s";
            }
            return temp;
        }
    }
    /// <summary>
    /// 角色卡数据
    /// </summary>
    public class CharacterInfo : CardInfo
    {
        public string Title { get; }//角色称号
        public string Describe { get; }//角色介绍
        public Skill[] Skills { get; }//角色技能组
        /// <summary>
        /// 测试用卡初始化-角色卡
        /// </summary>
        public CharacterInfo() : base()
        {
            Title = "Undefined"; Describe = "Undefined";
            Skills = new Skill[1];
            Skills[0] = new Skill(SkillType.Undefined, "Udefine");
        }
        /// <summary>
        /// 角色卡数据初始化
        /// </summary>
        /// <param name="series">卡片系列</param>
        /// <param name="snum">卡片系列内编号</param>
        /// <param name="rare">卡片罕贵度标识</param>
        /// <param name="name">卡片名称</param>
        /// <param name="ifc">当前卡是否为终符</param>
        /// <param name="type">当前卡片类型[角色/战斗/特殊]</param>
        /// <param name="ill">当前卡片画师信息</param>
        /// <param name="title">角色称号</param>
        /// <param name="describe">角色介绍</param>
        /// <param name="skills">角色技能组</param>
        public CharacterInfo(string series, int snum, string rare, string name, bool ifc, CardType type, string ill,
            string title, string describe, Skill[] skills)
            : base(series, snum, rare, name, ifc, type, ill)
        {
            Title = title; Describe = describe; Skills = skills;
        }
    }
    /// <summary>
    /// 战斗卡数据
    /// </summary>
    public class BattleInfo : CardInfo
    {
        public int Level { get; }//华丽度
        public int Cost { get; }//代价
        public int BattleValue { get; }//战力数值
        public BattleType BType { get; }//战斗类型
        public string EText { get; set; }//效果描述
        public string CText { get; set; }//条件描述
        public List<int> TList { get; set; }//此卡特性列表
        /// <summary>
        /// 测试用卡初始化-战斗卡
        /// </summary>
        public BattleInfo() : base()
        {
            Level = 0; Cost = 0; BattleValue = 0; BType = BattleType.Undefined; EText = "Undefined";
            CText = "Undefined"; TList = null;
        }
        /// <summary>
        /// 战斗卡数据初始化
        /// </summary>
        /// <param name="series">卡片系列</param>
        /// <param name="snum">卡片系列内编号</param>
        /// <param name="rare">卡片罕贵度标识</param>
        /// <param name="name">卡片名称</param>
        /// <param name="ifc">当前卡是否为终符</param>
        /// <param name="type">当前卡片类型[角色/战斗/特殊]</param>
        /// <param name="ill">当前卡片画师信息</param>
        /// <param name="level">华丽度</param>
        /// <param name="cost">代价</param>
        /// <param name="bv">战力数值</param>
        /// <param name="btype">战斗类型</param>
        /// <param name="etext">效果描述</param>
        /// <param name="ctext">条件描述</param>
        /// <param name="tlist">当前卡特性列表</param>
        public BattleInfo(string series, int snum, string rare, string name, bool ifc, CardType type, string ill,
            int level, int cost, int bv, BattleType btype, string etext, string ctext, List<int> tlist)
            : base(series, snum, rare, name, ifc, type, ill)
        {
            Level = level; Cost = cost; BattleValue = bv; BType = btype; EText = etext; CText = ctext; TList = tlist;
        }
        /// <summary>
        /// 检察数值大小[大于返回true]
        /// </summary>
        /// <param name="t">要检查的数据类别</param>
        /// <param name="value">数据参数</param>
        /// <returns></returns>
        public bool CheckNum(NumType t,int value)
        {
            switch (t)
            {
                case NumType.Level:
                    return (value > Level) ? true : false;
                case NumType.Cost:
                    return (value > Cost) ? true : false;
                case NumType.Battle:
                    return (value > BattleValue) ? true : false;
                default:
                    return false;
            }

        }
    }
    /// <summary>
    /// 特殊卡数据
    /// </summary>
    public class SpecialInfo : CardInfo
    {
        public int Level { get; }//华丽度
        public int Cost { get; }//代价
        public string EText { get;}//效果描述
        public string CText { get;}//条件描述
        public SpecialType SType { get; }//卡的所属分类
        /// <summary>
        /// 测试用卡初始化-战斗卡
        /// </summary>
        public SpecialInfo() : base()
        {
            Level = 0; Cost = 0; EText = "Undefined"; CText = "Undefined";
            SType = SpecialType.Undefined;
        }
        /// <summary>
        /// 特殊卡数据初始化
        /// </summary>
        /// <param name="series">卡片系列</param>
        /// <param name="snum">卡片系列内编号</param>
        /// <param name="rare">卡片罕贵度标识</param>
        /// <param name="name">卡片名称</param>
        /// <param name="ifc">当前卡是否为终符</param>
        /// <param name="type">当前卡片类型[角色/战斗/特殊]</param>
        /// <param name="ill">当前卡片画师信息</param>
        /// <param name="level">华丽度</param>
        /// <param name="cost">代价</param>
        /// <param name="etext">效果描述</param>
        /// <param name="ctext">条件描述</param>
        /// <param name="stype">卡的所属分类</param>
        public SpecialInfo(string series, int snum, string rare, string name, bool ifc, CardType type, string ill,
            int level, int cost, string etext, string ctext, SpecialType stype)
            : base(series, snum, rare, name, ifc, type, ill)
        {
            Level = level; Cost = cost; EText = etext; CText = ctext; SType = stype;
        }
        /// <summary>
        /// 检察数值大小[大于返回true]
        /// </summary>
        /// <param name="t">要检查的数据类别</param>
        /// <param name="value">数据参数</param>
        /// <returns>大于返回true，其他返回false</returns>
        public bool CheckNum(NumType t, int value)
        {
            switch (t)
            {
                case NumType.Level:
                    return (value > Level) ? true : false;
                case NumType.Cost:
                    return (value > Cost) ? true : false;
                default:
                    return false;
            }

        }
    }
}
